home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / tileblur.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  2.7 KB  |  75 lines

  1. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  2. ; At ECS Dept, University of Southampton, England.
  3.  
  4. ; This program is free software; you can redistribute it and/or modify
  5. ; it under the terms of the GNU General Public License as published by
  6. ; the Free Software Foundation; either version 2 of the License, or
  7. ; (at your option) any later version.
  8. ; This program is distributed in the hope that it will be useful,
  9. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. ; GNU General Public License for more details.
  12. ; You should have received a copy of the GNU General Public License
  13. ; along with this program; if not, write to the Free Software
  14. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15.  
  16.  
  17. (define (script-fu-tile-blur inImage inLayer inRadius inVert inHoriz inType)
  18.  
  19.    (set! theImage inImage)
  20.    (set! theLayer inLayer)
  21.    (set! theHeight (car (gimp-drawable-height theLayer)))
  22.    (set! theWidth (car (gimp-drawable-width theLayer)))
  23.  
  24.    (gimp-image-undo-group-start theImage)
  25.    (gimp-layer-resize theLayer (* 3 theWidth) (* 3 theHeight) 0 0)
  26.  
  27.    (gimp-rect-select theImage 0 0 theWidth theHeight CHANNEL-OP-REPLACE 0 0)
  28.    (gimp-edit-cut theLayer)
  29.  
  30.    (gimp-selection-none theImage)
  31.    (gimp-layer-set-offsets theLayer theWidth theHeight)
  32.  
  33.    (cjg-pasteat 1 1) (cjg-pasteat 1 2) (cjg-pasteat 1 3)
  34.    (cjg-pasteat 2 1) (cjg-pasteat 2 2) (cjg-pasteat 2 3)
  35.    (cjg-pasteat 3 1) (cjg-pasteat 3 2) (cjg-pasteat 3 3)
  36.  
  37.    (gimp-selection-none theImage)
  38.    (if (= inType 0)
  39.        (plug-in-gauss-iir TRUE theImage theLayer inRadius inHoriz inVert)
  40.        (plug-in-gauss-rle TRUE theImage theLayer inRadius inHoriz inVert)
  41.    )
  42.  
  43.    (gimp-layer-resize theLayer theWidth theHeight (- 0 theWidth) (- 0 theHeight))
  44.    (gimp-layer-set-offsets theLayer 0 0)
  45.    (gimp-image-undo-group-end theImage)
  46.    (gimp-displays-flush)
  47. )
  48.  
  49. (define (cjg-pasteat xoff yoff)
  50.    (let     ((theFloat (car(gimp-edit-paste theLayer 0))))
  51.         (gimp-layer-set-offsets theFloat (* xoff theWidth) (* yoff theHeight) )
  52.         (gimp-floating-sel-anchor theFloat)
  53.    )
  54. )
  55.  
  56.  
  57. (script-fu-register "script-fu-tile-blur"
  58.             _"_Tileable Blur..."
  59.             "Blurs image edges so that the final result tiles seamlessly"
  60.             "Chris Gutteridge"
  61.             "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
  62.             "25th April 1998"
  63.             "RGB*"
  64.             SF-IMAGE       "The Image"         0
  65.             SF-DRAWABLE    "The Layer"         0
  66.             SF-ADJUSTMENT _"Radius"            '(5 0 128 1 1 0 0)
  67.             SF-TOGGLE     _"Blur vertically"   TRUE
  68.             SF-TOGGLE     _"Blur horizontally" TRUE
  69.             SF-OPTION     _"Blur type"         '(_"IIR" _"RLE"))
  70.  
  71. (script-fu-menu-register "script-fu-tile-blur"
  72.              "<Image>/Filters/Blur")
  73.